package bmaso.purest;

import java.util.List;

import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;

public class ServiceTagTEI extends TagExtraInfo {

	@Override
	public VariableInfo[] getVariableInfo(TagData data) {
		List<String> varNames =ServiceTag.variableNamesFromTagAttributes(
				data.getAttributeString("uri"),
				data.getAttributeString("queryString"),
				data.getAttributeString("httpHeaders"),
				data.getAttributeString("cookies"));
		
		VariableInfo[] ret = new VariableInfo[varNames.size()+1];
		for(int ii=0 ; ii<varNames.size() ; ii++) {
			String varName = varNames.get(ii);
			ret[ii] = new VariableInfo(varName, "java.lang.String", true, VariableInfo.NESTED);
		}
		
		ret[varNames.size()] = new VariableInfo(RESTTagLibConstants.RESPONSE_GENERATED_REQUEST_ATTR,
				"java.lang.Boolean", true, VariableInfo.AT_END);
		
		return ret;
	}

}
